home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’97 / Warrior’s Progress / source code / Source / Libraries / Lists / ListNode.h < prev    next >
Encoding:
Text File  |  1997-06-28  |  699 b   |  38 lines  |  [TEXT/CWIE]

  1. // ListNode.h
  2.  
  3. #ifndef ListNode_h
  4. #define ListNode_h
  5.  
  6. #ifndef Assert_h
  7. #include "Assert.h"
  8. #endif
  9.  
  10. class ListNode
  11.   {
  12.     friend class List;
  13.     
  14.     private:
  15.         ListNode *next;        // mutable
  16.         ListNode *previous;    // mutable
  17.         List *owner;
  18.     
  19.         // not implemented:
  20.             ListNode( const ListNode& );
  21.             void operator=( const ListNode& );
  22.     
  23.     public:
  24.         ListNode();
  25.         ~ListNode();
  26.         
  27.         const ListNode *Next() const            { return next; }
  28.         const ListNode *Previous() const        { return previous; }
  29.         
  30.         ListNode *Next()                            { return next; }
  31.         ListNode *Previous()                        { return previous; }
  32.         
  33.         bool Owned() const                        { return owner != 0; }
  34.         List& Owner() const                        { Assert( owner != 0 ); return *owner; }
  35.   };
  36.  
  37. #endif
  38.